﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class adminlogin : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
         
         
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string a=Session["valid"].ToString().Trim();
        int? i;
        DataClassesDataContext db = new DataClassesDataContext();
        i = db.login_Admin(this.TextBox1.Text.ToString(), this.TextBox2.Text.ToString());
        if (i == 1 && a==TextBox3.Text.ToString().Trim())
        {
            Session["username"] = TextBox1.Text.ToString();
            Application["admin_logining"] = true;
            Response.Write("<script>alert('登陆成功！即将跳转到后台主界面');location.href='manage/Manage_main.aspx'</script>");

        }
        else
        {
            Response.Write("<script>alert('登陆失败！');location.href='adminlogin.aspx'</script>");
        }

    }
}